# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.SearchAds360.V0.Model.GoogleAdsSearchads360V0Common_WebpageInfo do
  @moduledoc """
  Represents a criterion for targeting webpages of an advertiser's website.

  ## Attributes

  *   `conditions` (*type:* `list(GoogleApi.SearchAds360.V0.Model.GoogleAdsSearchads360V0Common_WebpageConditionInfo.t)`, *default:* `nil`) - Conditions, or logical expressions, for webpage targeting. The list of webpage targeting conditions are and-ed together when evaluated for targeting. An empty list of conditions indicates all pages of the campaign's website are targeted. This field is required for CREATE operations and is prohibited on UPDATE operations.
  *   `coveragePercentage` (*type:* `float()`, *default:* `nil`) - Website criteria coverage percentage. This is the computed percentage of website coverage based on the website target, negative website target and negative keywords in the ad group and campaign. For instance, when coverage returns as 1, it indicates it has 100% coverage. This field is read-only.
  *   `criterionName` (*type:* `String.t`, *default:* `nil`) - The name of the criterion that is defined by this parameter. The name value will be used for identifying, sorting and filtering criteria with this type of parameters. This field is required for CREATE operations and is prohibited on UPDATE operations.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :conditions =>
            list(
              GoogleApi.SearchAds360.V0.Model.GoogleAdsSearchads360V0Common_WebpageConditionInfo.t()
            )
            | nil,
          :coveragePercentage => float() | nil,
          :criterionName => String.t() | nil
        }

  field(:conditions,
    as: GoogleApi.SearchAds360.V0.Model.GoogleAdsSearchads360V0Common_WebpageConditionInfo,
    type: :list
  )

  field(:coveragePercentage)
  field(:criterionName)
end

defimpl Poison.Decoder,
  for: GoogleApi.SearchAds360.V0.Model.GoogleAdsSearchads360V0Common_WebpageInfo do
  def decode(value, options) do
    GoogleApi.SearchAds360.V0.Model.GoogleAdsSearchads360V0Common_WebpageInfo.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.SearchAds360.V0.Model.GoogleAdsSearchads360V0Common_WebpageInfo do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
